package com.car.dal.dao.user;

import java.util.List;

import com.car.dal.dao.ibatis.IbatisCommonDao;
import com.car.dal.object.TgUser;
import com.car.dal.object.TgUserinfo;

public class UserDaoImpl extends IbatisCommonDao<TgUser, Long> implements UserDao {

	@Override
	public TgUser getTeacherByLoginName(String loginName) {
		TgUser entity=new TgUser();
		entity.setUsername(loginName);
		List<TgUser> hasuser=super.findByExample(entity);
		if (hasuser!=null&&hasuser.size()>0) {
			return hasuser.get(0);
		}
		return null;
	}
	
	public List<TgUser> getUserByUsername(TgUser user) {
		return this.queryForEntityList(TgUser.class,"getUserByUsername", user);
	}
	
	public TgUser getUserInfoByType(TgUser user) {
		List<TgUser> list=this.queryForEntityList(TgUser.class,"getUserInfoByType", user);
		if(list!=null && list.size()>0){
			return list.get(0);
		}
		return null;
	}
	
	public List<TgUser> getUserInfoByType2(TgUser user) {
		return this.queryForEntityList(TgUser.class,"getUserInfoByType2", user);
	}
	
	public List<TgUser> getUserInfoByType3(TgUser user) {
		return this.queryForEntityList(TgUser.class,"getUserInfoByType3", user);
	}


}
